home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / admin / linuxcon.000 / linuxcon / linuxconf-1.6 / misc / configf.h < prev    next >
C/C++ Source or Header  |  1996-08-03  |  2KB  |  88 lines

  1. #pragma interface
  2. #ifndef CONFIGF_H
  3. #define CONFIGF_H
  4.  
  5. /*
  6.     This class record help file path and serve as a runtime check
  7.     that there is no help file missing.
  8. */
  9. class HELP_FILE{
  10.     friend void helpf_checkall();
  11.     const char *subdir;
  12.     const char *fname;
  13.     char *path;        // Dynamically allocated buffer containing
  14.                     // the resolved path.
  15.     HELP_FILE *next;
  16.     /*~PROTOBEG~ HELP_FILE */
  17. public:
  18.     HELP_FILE (const char *_subdir, const char *_fname);
  19.     const char *getpath (void);
  20.     /*~PROTOEND~ HELP_FILE */
  21. };
  22.  
  23. extern HELP_FILE help_nil;    // Object to specify that there is
  24.                             // no help file available.
  25.  
  26. #define CONFIGF_NONE        0
  27. #define CONFIGF_MANAGED        1        // linuxconf do edit this file
  28. #define CONFIGF_PRIVATE        2        // Only root can see this
  29. #define CONFIGF_OPTIONNAL    4        // Don't complain if the file
  30.                                     // is missing.
  31. #define CONFIGF_GENERATED    8        // linuxconf do not edit
  32.                                     // the file, but generate it.
  33. #define CONFIGF_PROBED        16        // This file is checked to
  34.                                     // control a daemon                        
  35. #define CONFIGF_ERASED        32        // Erased at boot time
  36.  
  37. class CONFIG_FILE{
  38.     friend void configf_show();
  39.     friend void configf_booterase();
  40.     CONFIG_FILE *next;
  41.     const char *stdpath;
  42.     const char *realpath;    // The admin may move file around!
  43.     HELP_FILE &helpf;
  44.     int status;        // See CONFIGF_XXXXX
  45.     const char *owner;
  46.     const char *group;
  47.     int perm;
  48.     /*~PROTOBEG~ CONFIG_FILE */
  49. public:
  50.     CONFIG_FILE (const char *_path,
  51.          HELP_FILE&_helpfile,
  52.          int _status);
  53.     CONFIG_FILE (const char *_path,
  54.          HELP_FILE&_helpfile,
  55.          int _status,
  56.          const char *_owner,
  57.          const char *_group,
  58.          int _perm);
  59.     void editpath (void);
  60.     int exist (void)const;
  61. private:
  62.     void fixpath (void)const;
  63. public:
  64.     FILE *fopen (const char *mode);
  65.     FILE *fopen (const char *temp, const char *mode);
  66.     long getdate (void)const;
  67.     const char *gethelp (void)const;
  68.     const char *getpath (void)const;
  69.     const char *getstdpath (void)const;
  70. private:
  71.     void init (const char *_path,
  72.          int _status,
  73.          const char *_owner,
  74.          const char *_group,
  75.          int _perm);
  76. public:
  77.     int is_erased (void)const;
  78.     int is_generated (void)const;
  79.     int is_managed (void)const;
  80.     int is_optionnal (void)const;
  81.     int is_probed (void)const;
  82.     int setperm (const char *fpath);
  83.     int unlink (void)const;
  84.     /*~PROTOEND~ CONFIG_FILE */
  85. };
  86.  
  87. #endif
  88.